package com.msteam.extra.controller;

import java.util.List;

import com.jfinal.core.Controller;
import com.msteam.extra.model.DetailModel;
import com.msteam.extra.model.MasterModel;

import lombok.jfinal.annotations.RouterMapping;

@RouterMapping(url="/test")
public class MasterController extends Controller {

	public void index() {
		/*for(int i=0;i<100;i++){
			MasterModel.dao.paginate(getParaToInt(0, 1), 10, "select *", "from TABLE_MASTER order by ID asc");
		}*/
		setAttr("masterPage", MasterModel.dao.paginate(getParaToInt(0, 1), 10, "select *", "from TABLE_MASTER order by ID asc"));
		// 未来上面这行将变成如下形式：
		// setAttr("masterPage", MasterModel.dao.paginate(getParaToInt(0, 1), 10));
		// setAttr("masterPage", MasterModel.dao.paginate(getParaToInt(0, 1), 10,"ID","asc"));
		render("master.html");
	}
	public void detail(){
		Long masterId = this.getParaToLong("id");
		setAttr("master",MasterModel.dao.findById(masterId));
		render("detail.html");
		
	}
	public void detail2(){
		//Long masterId = this.getParaToLong("id");
		//setAttr("master",MasterModel.dao.findById(masterId));
		render("detail2.html");
		
	}
}
